﻿using MediatR;
using S.EarTag.Domain.Model;
using S.EarTag.Infrastructure.Repository.Interface.IEarTagRepository;
using S.EarTag.Read.API.Application.MediatorCommand.EarTagCommand;

namespace S.EarTag.Read.API.Application.MediatorCommandHandler.EarTagCommandHandler
{
    public class GetGetIdsCommandHandler : IRequestHandler<GetGetIdsCommand, List<EarTagModel>>
    {
        private readonly IEarTagModelRepository _earTagModelRepository;
        public GetGetIdsCommandHandler(IEarTagModelRepository earTagModelRepository)
        {
            _earTagModelRepository = earTagModelRepository;
        }
        /// <summary>
        /// 根据Ids实现批量查询
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public async Task<List<EarTagModel>> Handle(GetGetIdsCommand request, CancellationToken cancellationToken)
        {
            return await _earTagModelRepository.GetEarTagids(request.ids);
        }
    }
}
